import hashlib
import base64
import binascii



def convert_hex(s):
    ecode_str = s.encode()
    hex_string = binascii.hexlify(ecode_str).decode()
    return hex_string

def hex_convert_str(hex_string):
    string = binascii.a2b_hex(hex_string)
    return string.decode()



s = "露西亚的情人"
# test(s)
s = "终身的两个那是啥的法国"
# s = "中文中文中文中文中文中文"
s1 = convert_hex(s)
print("hex",s1)

s2 = hex_convert_str(s1)
print("hex_2_str",s2)